<%-- 
    Document   : group
    Created on : 21.04.2013, 22:03:49
    Author     : Yasya,Svetlana Shikhutskaya
--%>
<%@page import="javax.naming.NamingException"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="facade.GroupsFacadeLocal"%>
<%@page import="entity.Users"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    Users user = (Users) session.getAttribute("user");
    Integer pageNumber = (Integer) session.getAttribute("pageNumber");
    Integer pageCount = (Integer) session.getAttribute("pageCount");
    if (pageNumber == null) {
        pageNumber = 1;
    }
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/group.css">
        <link rel="stylesheet" type="text/css" href="css/all.css">
        <script type="text/javascript" src="scripts/jquery-1.8.3.min.js"></script>
        <script type="text/javascript" src="scripts/group.js"></script>
        <script type="text/javascript" src="scripts/admin.js"></script>
        <title>Work with product</title>
    </head>
    <body onload="init()">
        <header>
            <input id="pageNumber" type="hidden" value="<%=pageNumber%>"/>
            <input id="pageCount" type="hidden" value="<%=pageCount%>"/>
            
            <div class ="top_name"> <a href="main.jsp"> <img src="/Delta-war/product/1.jpeg"> </a> <h1> Group management </h1> </div>
            
            <div id="registr2">

                <p> <a href="user_name.jsp"><%=user.getLogin()%></a>
                    <a href="main.jsp">LogOut</a> </p>
            </div>


        </header>
        <div class="main">
            <div class="find">
                <form method="POST" action=""> 
                    <p><strong>Groups</strong></p>   
                    <p><select id="page-count" onchange="loadGroups()">
                            <option value="5" <%if (pageCount == 5) {%> selected <%}%>>5</option>
                            <option value="10"<%if (pageCount == 10) {%> selected <%}%>>10</option>
                            <option value="15"<%if (pageCount == 15) {%> selected <%}%>>15</option>
                            <option value="20"<%if (pageCount == 20) {%> selected <%}%>>20</option>
                        </select>
                        <span> groups per page</span>
                    </p>
                </form>
            </div>
            <div class="group">
                <table class="group-table">
                    <TR>
                        <td class="check"></td>
                        <td class="head"><strong> Name</strong></td>
                        <td class="head"><strong> Roles </strong></td>

                    </TR>
                </table>

                <div id="func">
                    <div class="line_button">
                        <form class="js-left-page" method="Post">
                            <button type="submit"><<</button> 
                            <span style="font-size: 14px" id="num"></span>
                            <span style="font-size: 14px"> of </span>
                            <span style="font-size: 14px" id="total-num"></span>
                            <span style="font-size: 14px"> pages</span>
                        </form>
                    </div>
                    <div class="line_button">
                        <form class="js-right-page" method="Post">
                            <button type="submit">>></button>
                        </form>
                    </div>
                    <div class="line_button">
                        <input id="jump-page" oninput="validateJumpPage()" type="text"/>
                    </div>
                    <div class="line_button">
                        <form class="js-jump-page" method="Post">
                            <button id="jump-btn" type="submit" disabled="true">Jump</button>
                        </form>
                    </div>
                    <div class="line_button">
                        <span style="font-size: 14px; color: red" id="jump-warning"></span>
                    </div>
                </div><br><br>
                <div id="">
                    <div class="line_button">
                        <form class="js-back-page" method="Post">
                            <button type="submit">Back</button> 
                        </form>
                    </div>
                    <div class="line_button"> 
                        <form class="js-creategroup" method="Post">
                            <button type="submit">Create</button> 
                        </form> 
                    </div>
                    <div class="line_button"> 
                        <form class="js-editgroup" method="Post">
                            <button type="submit">Edit*</button> 
                        </form> 
                    </div>
                    <div class="line_button"> 
                        <form class="js-deletegroup" method="Post">
                            <button type="submit">Delete</button> 
                        </form> 
                    </div>
                    <span class="warningDelete" id="warningDelete" style="color: red; margin-left: 10px"></span>
                </div>
                <br>
                <span id="warningEdit" style="margin-left: 20px; color: red">* For editing you should select only one group</span>
                <div id="block" style="display: none">
                    <form method="POST" class="js-creategroup-form"> 
                        <p>Name:<font color="red">*</font><input type="text" oninput="checkEditGroupName()" maxlength="50" id="groupNameEdit" name="GroupNameEdit" size="20"/>
                            <input type="text" oninput="checkCreateGroupName()" maxlength="50" id="groupNameCreate" style=" position: relative; bottom: 20px; "name="GroupNameCreate" size="20" placeholder="Enter the name"/><span id="warningGrName" style="position: relative; color: red; margin-left: 230px; bottom: 45px;  "></span><br>
                        <div id="st" style="position: relative; bottom: 50px;">
                            Role:<font color="red">*</font><br>
                        </div>
                        <div class="blok_in">
                            <input type="checkbox" id="Admin" size="50" />Administrator<br>
                            <input type="checkbox" id="Warehouse_Employee" size="50" />Warehouse Employee<br>
                            <input type="checkbox" id="Courier" size="50" />Courier<br>
                            <input type="checkbox" id="Customer" size="50" />Customer<br>
                        </div>
                        <button id="create" type="submit" disabled="true" style="display: none">Create</button>
                        <button id="edit" type="submit" style="display: none">Edit</button>
                    </form>
                    <form id="minimize" method="post">
                        <button class="Minimize" type="submit">Cancel</button>
                    </form>
                    <span id="infoRoles" style="position: relative; color: red; margin-left: 10px; bottom: 120px; ">* At least one role must be selected</span>
                </div>
            </div>
        </div>
    </div>
    <div id="footer">
                                <p>  &#169;All rights reserved</p>
                            </div>
</body>
</html>

